<?php

use Monolog\Logger;
use Monolog\Handler\AbstractProcessingHandler;

class FirePHPHandler extends AbstractProcessingHandler
{
    public function __construct($level = Logger::DEBUG, $bubble = true)
    {
        parent::__construct($level, $bubble);
    }

    protected function write(array $record)
    {
        FB::group(sprintf('[%s] %s: %s', $record['datetime']->format('Y-m-d H:i:s'), strtolower($record['level_name']), $record['message']), ['Collapsed' => true]);
        FB::info($record['context'], 'context:');
        FB::groupEnd();
    }
}